-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: can: mcan: refactor to get rid of wrapper functions #44951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: can: mcan: refactor to get rid of wrapper functions #44951
Conversation
5fb8217 to
15ae8f2
Compare
Rename the private header file for the Bosch M_CAN shared driver code from can_mcan_int.h to can_mcan_priv.h to follow the common naming scheme. Signed-off-by: Henrik Brix Andersen <[email protected]>
Refactor the Bosch M_CAN shared driver functions to get rid of the front-end driver wrapper functions. This requires flipping the relationship between shared config/data structs and front-end config/data structs. Front-end drivers can now store a pointer to their custom config/data structs in the .custom fields of the can_mcan_config and can_mcan_data data structures. Signed-off-by: Henrik Brix Andersen <[email protected]>
15ae8f2 to
ca4bd58
Compare
|
There are no functional changes in this PR, only refactoring to get rid of the wrapper functions. Reviews are most welcome. |
gmarull
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, one suggestion/comment
drivers/can/can_mcux_mcan.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe provide DT based macros to avoid usage of DT_DRV_INST, maybe to define as well, e.g.
CAN_MCAN_CONFIG_DT_INST_DEFINE(n, &mcux_can_config_##n);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I had initially added inst variants as the only variants, but decided to go for a more generic node_id approach. I have added both now and (re-)named them to reflect the DT part.
Add shared initializer macros for struct can_mcan_config and struct can_mcan_data. Signed-off-by: Henrik Brix Andersen <[email protected]>
ca4bd58 to
d76e1de
Compare
|
@alexanderwachter, @martinjaeger et al: please take a look. |
Refactor the Bosch M_CAN shared driver functions to get rid of the front-end driver wrapper functions.
This requires flipping the relationship between shared config/data structs and front-end config/data structs. Front-end drivers can now store a pointer to their custom config/data structs in the .custom fields of the
can_mcan_configandcan_mcan_datadata structures.Rename the private header file for the Bosch M_CAN shared driver code from
can_mcan_int.htocan_mcan_priv.hto follow the common naming scheme.Add shared initializer macros for
struct can_mcan_configandstruct can_mcan_data.The changes were tested on hardware for the following drivers:
The changes were only compile-tested for the following drivers due to lack of hardware. Additional testing most welcome.